package xhwl.hmo.mall.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.Constant;
import xhwl.hmo.mall.MyApp;
import xhwl.hmo.mall.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017-07-26.
 */

public class UpdateLoginInfoApi extends BaseApi {
    UpdateLoginInfoReq req;
    public UpdateLoginInfoApi(String link_mobile, String phone_id, String phone_union, String verson_name){
        req=new UpdateLoginInfoReq(link_mobile,phone_id,phone_union,verson_name);
    }
    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).updateLoginInfo(requestBody);
    }
    private class UpdateLoginInfoReq{
        private String link_mobile;
        private String phone_id;
        private String phone_type;//1-安卓 0-ios
        private String phone_union;//手机型号
        private String lat;
        private String lng;
        private String client_type;
        private String yw_id;
        private String version_num;


        public UpdateLoginInfoReq(String link_mobile, String phone_id, String phone_union, String verson_name) {
            super();
            this.yw_id= Constant.YW_ID;
            this.client_type=Constant.CLIENT_TYPE;
            this.lat= MyApp.lat;
            this.lng = MyApp.lng;
            this.phone_type="1";
            this.link_mobile=link_mobile;
            this.phone_id=phone_id;
            this.phone_union=phone_union;
            this.version_num=verson_name;
        }


    }
}
